<link href='/public/css/news.css' rel='stylesheet' type='text/css'>

<div id="NewsViewModel">

	<div class="row row-tournament-name">
		<div class="col-xs-12 text-center">
			<h1><strong><?php echo $this->currentTournament->name; ?></strong></h1>
			<p><?php echo $this->currentTournament->description; ?></p>
		</div>
	</div>
	
	<div class="row row-tournament-news" data-bind="foreach: news">
		
		<div class="col-xs-8 col-xs-offset-2 news">
			<div class="panel panel-default">
	        	<div class="panel-heading"><h3 class="panel-title" data-bind="text: username"></h3></div>
	            <div class="panel-body" data-bind="text: description"></div>
	            <div class="panel-footer" data-bind="text: date"></div>
	    	</div>
		</div>
		
	</div>

	<div class="row row-load-more-news text-center">
		<div class="col-xs-4 col-xs-offset-4" data-bind="visible: !isLoadingMoreNews() && !noMoreNews()">
			<button class="btn btn-default" data-bind="click: loadMoreNews">
				<?php echo Yii::t( 'site', 'Load older news' ); ?>
			</button>
		</div>
		<div class="col-xs-4 col-xs-offset-4" data-bind="visible: isLoadingMoreNews() && !noMoreNews()">
			<i class="fa fa-spinner fa-spin"></i>
		</div>
		<div class="col-xs-4 col-xs-offset-4" data-bind="visible: noMoreNews()">
			<span style="font-size: 32px">*</span>
		</div>
	</div>
	
</div>

<script src="/public/js/objects/New.js" type="text/javascript"></script>
<script src="/public/js/NewsViewModel.js" type="text/javascript"></script>
<script>
	var newsViewModel = new NewsViewModel( <?=$this->currentTournament->idTournament?> );
	$( document ).ready( function(){ ko.applyBindings( newsViewModel, document.getElementById( 'NewsViewModel' ) ); } );
</script>

